/*!
 * Made by 黄文浩
 *
 * Date: 2013年03月
 */
$(".uploadphoto").click(
function(){
	uploadDialog(1);
});

$(".uploadvideo").click(
function(){
	uploadDialog(2);
});

function uploadDialog(i){
	$("#full_bg").show();
	
	var Ttype = i;
	
	var html = '';
	html = html + '<div id="upload_con">';
	html = html + '<div class="close"></div>';
	if(Ttype == 1){
		html = html + '<ul class="list_upload list_upload_photo">';
	}else{
		html = html + '<ul class="list_upload">';
	}
	html = html + '<li><span class="uf_tip"></span><span class="uf_con">http://user.qzone.qq.com/12696291/ph.........</span><span class="uf_stata">待发布</span><span class="uf_btn"></span></li>';
	html = html + '<li><span class="uf_tip"></span><span class="uf_con">http://user.qzone.qq.com/12696291/ph.........</span><span class="uf_stata">待发布</span><span class="uf_btn"></span></li>';
	html = html + '</ul>';
	html = html + '<div class="upload_add clearfix">';
	html = html + '<span></span>继续添加';
	html = html + '<a href="javascript:void(0);" class="btn fr">提交发布</a>';
	html = html + '</div>';
	html = html + '<div class="upload_item">';
	if(Ttype == 1){
		html = html + '<div class="upload_add_img clearfix">';
		html = html + '<span onclick="javascript:$(\'#fpPhoto\').click();"></span>上传照片<em>照片大小不超过2M，格式为jpg，jpeg，gif</em>';
		html = html + '<input id="fpPhoto" name="fpPhoto" type="file" style="display:none;" />'
		html = html + '</div>';
	}else{
		html = html + '<div class="pf_item">';
		html = html + '<span class="pf_sub">视频链接：</span>';
		html = html + '<span class="pf_con"><input type="text" class="input"></span>';
		html = html + '</div>';
	}
	html = html + '<div class="pf_item">';
	html = html + '<span class="pf_sub">描述：</span>';
	html = html + '<span class="pf_con"><textarea id="txtDesc" name="txtDesc" class="textarea"></textarea></span>';
	html = html + '</div>';
	html = html + '<div class="area_btn"><a href="javascript:$(\'#btnUpload\').click();" class="btn">确认</a><input style="display:none" id="btnUpload" type="submit"/></div>';
	html = html + '</div>';
	html = html + '</div>';

	$("#full_bg").after(html);
	$("#upload_con").show();
	
	Fixed();
	/*
	$(".btn").click(
	function(){
		$(".upload_item").hide();
		$(".list_upload").show();
		$(".upload_add").show();
		Fixed();
	});
	$(".upload_add span").click(
	function(){
		$(".upload_add").hide();
		$(".upload_item").show();
		Fixed();
	});
	
	
	$("#full_bg").click(
	function(){
		$("#full_bg").hide();
		$("#upload_con").hide();
		$("#upload_con").remove();
	});
    */
	$(".close").click(
	function(){
		$("#full_bg").hide();
		$("#upload_con").hide();
		$("#upload_con").remove();
	});
}
function Fixed(){
	var bH = $("body").height();
	var bW = $("body").width();
	var wW = (bW - 540) / 2;
	var hH = $(document).scrollTop() + ($(window).height() - $("#upload_con").height()) / 2;
	$("#full_bg").css({ width: bW, height: bH });
	$("#upload_con").css({left: wW, top: hH });
}